package com.easylinkin.linkappapi.application.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.easylinkin.linkappapi.application.entity.Application;
import com.easylinkin.linkappapi.application.entity.ApplicationRefDeviceUnitDTO;
import com.easylinkin.linkappapi.application.entity.ApplicationRefPrivilegeDTO;
import com.easylinkin.linkappapi.deviceunit.entity.DeviceUnit;
import com.easylinkin.linkappapi.security.entity.LinkappPrivilege;

import java.util.List;

/**
 * <p>
 * 应用管理表 服务类
 * </p>
 *
 * @author XuGuoQing
 * @since 2020-05-19
 */
public interface ApplicationService extends IService<Application> {

    boolean updateApplication(Application application);

    boolean addApplication(Application application);

    boolean deleteApplication(List<String> applicationList);

    IPage<Application> getPage(IPage page, Application application);

    List<Application>  getApplicationList();

    Application getApplication(QueryWrapper<Application> wrapper);

    List<DeviceUnit> selectDeviceUnitByApplication(String id);

    List<DeviceUnit> selectApplicationDeviceUnitByUser(String id);

    List<LinkappPrivilege> selectApplicationPrivilegeMenuByUser(String id);

    void application2DeviceUnits(ApplicationRefDeviceUnitDTO applicationRefDeviceUnitDTO);

	List<LinkappPrivilege> selectPrivilegeByApplication(String id);

	void application2Privileges(ApplicationRefPrivilegeDTO applicationRefPrivilegeDTO);

    List<Application> selectApplicationByUser(String id);

    /**
     * @param id    用户ID
     * @param type  PC和小程序类型区分, 0：PC端，1:小程序端
     * @return
     */
	List<LinkappPrivilege> selectApplicationPrivilegeByUser(String id, Integer type);

    /**
     * 个性化菜单
     * @param id 用户ID
     * @param type
     * @return
     */
    List<LinkappPrivilege> selectApplicationPrivilegeCustomByUser(String tenantId, String id, Integer type);


    List<DeviceUnit> selectApplicationDeviceUnit(String id, String deviceTypeName);

}
